<template>
  <div>
      <h1>{{ title }}</h1>
      <h1>{{ msg }}</h1>
      <h1 @click="$emit('childClick', msg)">提示</h1>
      <button @click="sendMsg">发送child消息</button>

  </div>
</template>
<script>
import { ref } from "vue";
import bus from "vue3-eventbus";
export default {
  props: {
      title: String
  },
  setup() {
      const msg = ref("我是子组件的值");
      const sendMsg = () => {
          console.log("发送child的消息")
          bus.emit("getMsg", "我是child组件")
      };
      return {
          msg,
          sendMsg
      };
  }
};

</script>